package com.yibo.blog.controller;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.yibo.support.pojo.IResult;
import com.yibo.support.pojo.Result;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static com.yibo.support.constant.ApiUrlConstant.PRIVATE_URL;
import static com.yibo.support.constant.ApiUrlConstant.PUBLIC_URL;

@RestController
@RequestMapping(PUBLIC_URL+"/blog/base")
public class BaseController {

    @RequestMapping("/test")
    @HystrixCommand(fallbackMethod = "testBack")
    public IResult test(){
        return new Result<>("查询成功","blog_test");
    }

    public IResult testBack(){
        return new Result("查询失败",null);
    }
}
